<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="./mock.js"></script>
</head>

<body>

  <script>
    const Random = Mock.Random
    const fakeIndexData = (len = 78) => {
      const indexData = []
      for (let i = 0; i < len; i++) {
        indexData.push({
          id: i + 1,
          avatar: 'https://picsum.photos/200/200?random='+Random.natural(0,200),
          title: Random.ctitle(6, 15),
          desc: Random.csentence(3, 6),
          location: Random.city(),
          distance: Random.float(100, 5000, 1, 3),
          tag: [... new Set(Random.cword('点预堂', 1, 3))].join('')
        })

      }
      return indexData
    }
    console.log('fakeIndexData()',fakeIndexData())

    const fakeCategoryList = (len = 12) => {
      const Data = []
      for (let i = 0; i < len; i++) {
        const o = {}
        o.cid = i + 1
        // o.name = Random.ctitle(2, 5)
        o.main_name = Random.ctitle(2, 5)
        o.data = []
        for (let j = 0; j < Random.natural(3, 7); j++) {
          const info = []
          for (let k = 0; k < Random.natural(8, 10); k++) {
            const name = Random.ctitle(2, 4)
            info.push({
              imgurl: Random.image('200x200', '#02adea', 'diancan'),
              son_name: name,
              price: Random.natural(0, 200),
            })
          }
          o.data.push({
            next_name: Random.ctitle(2, 5),
            info: info

          })
        }

        Data.push(o)

      }
      return Data
    }
    // console.log('fakeCategoryList()', fakeCategoryList())

    const recommendFoodList = (len) => {
      const list = []
      for (i = 0; i < len; i++) {
        const o = {
          id:Random.guid(),
          img:'https://picsum.photos/224/168?random='+Random.natural(0,200),
          name: Random.ctitle(3, 7)
        }
        list.push(o)

      }
      return list
    }
    console.log('recommendFoodList(10)',recommendFoodList(10))
  </script>
</body>

</html>